package knowledge

import "errors"

var (
	// ErrDocumentNotFound indicates document was not found
	ErrDocumentNotFound = errors.New("document not found")

	// ErrInvalidEmbedding indicates invalid embedding vector
	ErrInvalidEmbedding = errors.New("invalid embedding vector")

	// ErrSourceNotFound indicates knowledge source not found
	ErrSourceNotFound = errors.New("knowledge source not found")

	// ErrSourceUpdateFailed indicates source update failed
	ErrSourceUpdateFailed = errors.New("source update failed")

	// ErrIndexingFailed indicates document indexing failed
	ErrIndexingFailed = errors.New("document indexing failed")

	// ErrSearchFailed indicates search operation failed
	ErrSearchFailed = errors.New("search operation failed")
)

// SourceError wraps source-specific errors
type SourceError struct {
	Source string
	Err    error
}

func (e *SourceError) Error() string {
	return "source error: " + e.Source + ": " + e.Err.Error()
}

func (e *SourceError) Unwrap() error {
	return e.Err
}
